import axios from 'axios'
const config = require('../utils/base')

export const ContentAction = (params) => {
    console.log('LickContentAction', params)
    let type = params.type
    let data = params.data
    console.log(config.api.content + type)
    return dispatch => {
        return axios.post(config.api.content + type, data)
        // return axios.get('http://localhost:8000/users', data)
            .then(res => {
                console.log('contentction', res.data)
                if (res.status === 200 && res.data.code === 0) {
                    dispatch({
                        type: 'CONTENT_SUCCESS',
                        payload: res.data
                    })
                } else {
                    dispatch({
                        type: 'CONTENT_ERROR_MSG',
                        payload: res.data
                    })
                }
            })
    }
}